package com.garrigou.spaceship.scenes;

import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.garrigou.spaceship.camera.OrthoCamController;
import com.garrigou.spaceship.domain.Profile;
import com.garrigou.spaceship.layer.AsteroidLayer;
import com.garrigou.spaceship.layer.ControlLayer;
import com.garrigou.spaceship.layer.ShipLayer;

public class GameScene extends Scene
{
  private Layer              controlLayer;
  private ShipLayer          shipLayer;
  private OrthoCamController camController;
  private AsteroidLayer      asteroidLayer;

  /**
   * Application game scene.
   * 
   */
  public GameScene(Profile profile, TextureAtlas atlas)
  {
    // ---------------------------------------------------------------
    // Background layer
    // ---------------------------------------------------------------
    camController = new OrthoCamController(getSpriteBatch());
    addActor(camController);

    // ---------------------------------------------------------------
    // Control layer
    // ---------------------------------------------------------------
    controlLayer = new ControlLayer();
    getInputMultiplexer().addProcessor(controlLayer);
    addLayer(controlLayer);

    // ---------------------------------------------------------------
    // Asteroid Layer
    // ---------------------------------------------------------------
    asteroidLayer = new AsteroidLayer(getWidth(), getHeight(), atlas);
    addLayer(asteroidLayer);

    // ---------------------------------------------------------------
    // Ship layer
    // ---------------------------------------------------------------
    shipLayer = new ShipLayer(getWidth(), getHeight(), profile, atlas);
    camController.setShip(shipLayer.getShip());
    getInputMultiplexer().addProcessor(shipLayer);
    addLayer(shipLayer);

  }
}
